﻿using Sustainalytics.ClientDW.DataAccessLayer;
using Sustainalytics.ClientDW.Entities;
using System;
using System.Collections.Generic;

namespace Sustainalytics.GCCS
{
    public class GCSourceManager : IGCSourceManager
    {
        private readonly IClientDWGlobalCompactRepository _gccRepo;


        public GCSourceManager(IClientDWGlobalCompactRepository gccRepo)
        {
            this._gccRepo = gccRepo;
        }


        public List<GCSource> GetList(Guid companyId, int? type, GCAssessment? eventIndicatorAssessment)
        {
            try
            {
                GCCEventSource.Log.GCSource_GetList(companyId);

                var lst = this._gccRepo.GetGCSourceList(companyId, type, eventIndicatorAssessment);

                GCCEventSource.Log.GCSource_GetList_Success(companyId);

                return lst;
            }
            catch (Exception ex)
            {
                GCCEventSource.Log.GCSource_GetList_Error(companyId, ex);
                throw;
            }
        }
    }
}
